home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Sunday Times: The Month 2003 September
/
The Sunday Times - The Month 2003-09.iso
/
mac
/
The Month SEP 03
/
assets
/
bespoke
/
feature
/
feature_shell.swf
/
scripts
/
frame_2
/
DoAction.as
Wrap
Text File
|
2003-08-12
|
12KB
|
408 lines
stop();
X_OFFSET = 15;
Y_OFFSET = 112;
Feature = new Object();
Feature.depthCount = 1;
var stage = this;
var navOpen = false;
var sliderPositions = [35.9,205.2,411.1,484.9,496,507.1,518.2,529.3,660.1];
var sliderLabels = ["introduction","section1","section2","section2_1_1","section2_2_1","section2_3_1","section2_4_1","section2_5_1","section3"];
var fileToLoad;
var currentFile;
var basePath = "feature_movies/";
var clipNames = ["section1","section2","lies01","lies02","lies03","lies04","lies05","section3"];
var barColour0 = [35,118,214];
var barColour1 = [35,118,214];
var barColour2 = [204,0,0];
var barColour3 = [255,102,153];
var barColour4 = [204,0,0];
var barColour5 = [35,118,214];
var barColour6 = [255,255,255];
var barColour7 = [255,51,102];
var barColour8 = [255,255,255];
var barColour9 = [255,102,153];
var barColour10 = [35,118,214];
var textColour1 = [255,255,255];
var textColour2 = [255,255,255];
var textColour3 = [255,255,255];
var textColour4 = [0,0,0];
var textColour5 = [255,255,255];
var textColour6 = [255,255,255];
var textColour7 = [221,65,47];
var textColour8 = [0,204,255];
var textColour9 = [61,118,148];
var textColour10 = [255,255,255];
var textColour11 = [0,0,0];
var sliderColour1 = [255,255,255];
var sliderColour2 = [255,255,255];
var sliderColour3 = [255,255,255];
var sliderColour4 = [255,255,255];
var sliderColour5 = [255,255,255];
var sliderColour6 = [255,255,255];
var sliderColour7 = [221,65,47];
var sliderColour8 = [255,255,255];
var sliderColour9 = [61,118,148];
var sliderColour10 = [255,255,255];
var sliderColour11 = [255,255,255];
var idCount = 1;
var idRef;
var objsInTransition = new Array();
var intIds = new Array();
this.createEmptyMovieClip("introHolder",2);
introHolder._x = X_OFFSET;
introHolder._y = Y_OFFSET;
checkVideoProgress = function()
{
if(this._currentframe == this._totalframes && this._totalframes > 1)
{
this._parent.isIntroPlaying = false;
if(this._parent.videoLoader.numPlays == 0)
{
this._parent.createNav();
this._parent.videoLoader.numPlays = this._parent.videoLoader.numPlays + 1;
}
this._parent.currentFile = this._parent.clipHandle = this._parent.clipNames[0];
this._parent[clipHandle].gotoAndPlay(1);
this._visible = false;
this.gotoAndStop(1);
delete this.onEnterFrame;
}
};
createNav = function()
{
this.attachMovie("menuBtn","menuBtn",3);
this.menuBtn._x = 33.4 + X_OFFSET;
this.menuBtn._y = 363.3 + Y_OFFSET;
mSliderBarX = 19 + X_OFFSET;
mSliderBarY = 374 + Y_OFFSET;
this.attachMovie("sliderBg","sliderBg",4);
this.sliderBg._x = mSliderBarX;
this.sliderBg._y = mSliderBarY;
this.attachMovie("slider","slider",5);
this.slider.x = stage.slider._x = stage.sliderBg._x + sliderPositions[1];
this.slider.y = stage.slider._y = mSliderBarY - stage.slider._height / 2;
this.slider.maxSlide = stage.sliderBg._x + stage.sliderBg._width - stage.slider._width / 2;
this.slider.minSlide = stage.sliderBg._x + stage.slider._width / 2;
this.slider.inAction = false;
barCol = new Color(this.sliderBg.bg.bgBar);
colTransform = new Object();
colTransform = {ra:"0",rb:barColour1[0],ga:"0",gb:barColour1[1],ba:"0",bb:barColour1[2],aa:"100",ab:"0"};
barCol.setTransform(colTransform);
delete colTransform;
objsInTransition.push(this.sliderBg.bg.bgBar);
sliderCol = new Color(this.slider);
colTransform = new Object();
colTransform = {ra:"0",rb:sliderColour1[0],ga:"0",gb:sliderColour1[1],ba:"0",bb:sliderColour1[2],aa:"100",ab:"0"};
sliderCol.setTransform(colTransform);
delete colTransform;
objsInTransition.push(this.slider);
textCol = new Color(this.menuBtn);
colTransform = new Object();
colTransform = {ra:"0",rb:textColour1[0],ga:"0",gb:textColour1[1],ba:"0",bb:textColour1[2],aa:"100",ab:"0"};
textCol.setTransform(colTransform);
delete colTransform;
objsInTransition.push(this.menuBtn);
Feature.activeBut = "butFantasy";
};
clickNav = function(i, c)
{
var index = i;
videoFullscreenClose();
silentStream.gotoAndPlay(1);
if(sliderLabels[i] == currentFile)
{
stopAllSounds();
this[clipHandle].replayMovie();
}
else
{
if(index == 0 && isIntroPlaying == false | (index == 0 && isIntroPlaying == null))
{
this[clipHandle].removeMovieClip();
isIntroPlaying = true;
clipHandle = "introVideoClip";
currentFile = "introVideoClip";
videoLoader.gotoAndPlay(3);
if(videoLoader.numPlays > 0)
{
slider.inAction = true;
slider.onEnterFrame = function()
{
var distanceToMove = stage.sliderBg._x + sliderPositions[0] - this._x;
this._x += distanceToMove / 8;
if(Math.abs(distanceToMove) < 1)
{
delete this.onEnterFrame;
slider.inAction = false;
}
};
introHolder.play();
}
setColourScheme(c);
}
else if(index == 0 && isIntroPlaying == true)
{
introHolder.gotoAndPlay(1);
}
else if(index == 1 && isIntroPlaying == true)
{
introHolder.gotoAndStop(1);
introHolder._visible = false;
isIntroPlaying = false;
currentFile = clipHandle = sliderLabels[i];
setColourScheme(c);
introHolder.stop();
introHolder._visible = false;
slider.inAction = true;
slider.onEnterFrame = function(index)
{
var distanceToMove = stage.sliderBg._x + sliderPositions[i] - this._x;
this._x += distanceToMove / 8;
if(Math.abs(distanceToMove) < 1)
{
delete this.onEnterFrame;
slider.inAction = false;
}
};
}
else
{
currentFile = sliderLabels[i];
isIntroPlaying = false;
setColourScheme(c);
introHolder.stop();
introHolder._visible = false;
this[clipHandle].removeMovieClip();
clipHandle = clipNames[i - 1];
this.createEmptyMovieClip(clipNames[i - 1],1);
this[clipHandle]._x = X_OFFSET;
this[clipHandle]._y = Y_OFFSET;
slider.inAction = true;
slider.onEnterFrame = function(index)
{
var distanceToMove = stage.sliderBg._x + sliderPositions[i] - this._x;
this._x += distanceToMove / 8;
if(Math.abs(distanceToMove) < 1)
{
delete this.onEnterFrame;
slider.inAction = false;
}
};
loadMovie(basePath + sliderLabels[i] + ".swf",this[clipHandle]);
}
doColourise("sliderBg.bg.bgBar","barColour" + i,"barCol");
doColourise("slider","sliderColour" + c,"sliderCol");
doColourise("menuBtn","textColour" + c,"textCol");
}
};
loadSection1 = function(numVideoPlays)
{
this.createEmptyMovieClip(clipNames[0],1);
section1._x = X_OFFSET;
section1._y = Y_OFFSET;
loadMovie(basePath + "section1.swf","section1");
};
tweenMovement = function()
{
if(stage.ghostSlider._visible)
{
stage.ghostSlider._x += (stage._xmouse - stage.ghostSlider._x) / 8;
if(stage.ghostSlider._x > stage.ghostSlider.maxSlide)
{
stage.ghostSlider._x = stage.ghostSlider.maxSlide;
}
else if(stage.ghostSlider._x < stage.ghostSlider.minSlide)
{
stage.ghostSlider._x = stage.ghostSlider.minSlide;
}
}
};
createGhostSlider = function()
{
this.attachMovie("slider","ghostSlider",6);
this.ghostSlider._x = this.slider._x;
this.ghostSlider._y = this.slider._y + 3;
this.ghostSlider.maxSlide = this.sliderBg._x + this.sliderBg._width - this.ghostSlider._width / 2;
this.ghostSlider.minSlide = this.sliderBg._x + this.ghostSlider._width / 2;
this.ghostSlider._alpha = 40;
this.ghostSlider._visible = 0;
};
updateNav = function()
{
if(stage._ymouse > 350 + Y_OFFSET && stage._ymouse < 380 + Y_OFFSET && navOpen == false)
{
navOpen = true;
enableNav();
}
else if(stage._ymouse <= 350 + Y_OFFSET | stage._ymouse >= 380 + Y_OFFSET && navOpen == true)
{
navOpen = false;
disableNav();
}
};
setInterval(updateNav,20);
enableNav = function()
{
this.createEmptyMovieClip("controller",999999);
this.controller.onEnterFrame = function()
{
if(stage.slider._currentframe == stage.slider._totalframes)
{
trace("ghostSlider should be visible");
this._parent.ghostSlider._visible = 1;
ghostInterval = setInterval(tweenMovement,15);
delete this.onEnterFrame;
this.removeMovieClip();
}
else
{
stage.slider.nextFrame();
}
};
stage.sliderBg.play();
};
disableNav = function()
{
stage.sliderBg.onEnterFrame = reverseTimeline;
stage.createEmptyMovieClip("controller",999999);
stage.controller.onEnterFrame = function()
{
if(stage.slider._currentframe == 1)
{
delete this.onEnterFrame;
this.removeMovieClip();
}
else
{
stage.slider.prevFrame();
}
};
stage.ghostSlider._visible = 0;
clearInterval(ghostInterval);
};
reverseTimeline = function()
{
if(this._currentframe == 1)
{
delete this.onEnterFrame;
}
else
{
this.prevFrame();
}
};
doColourise = function(targ, colRef, colObj)
{
var speed = 4;
var i = 0;
var intName = colRef + "id" + idCount;
var numTransitionObjs = objsInTransition.length;
idCount++;
do
{
if(objsInTransition[i] == targ)
{
clearInterval(intIds[i]);
intIds.splice(i,1);
objsInTransition.splice(i,1);
}
i++;
}
while(i < numTransitionObjs);
objsInTransition.push(targ);
intIds.push(intName);
var r;
var g;
var b;
r = stage[colRef][0];
g = stage[colRef][1];
b = stage[colRef][2];
idRef = intName;
stage[intName] = setInterval(changeColour,40,r,g,b,speed,intName,targ,colObj);
};
changeColour = function(r, g, b, speed, name, targ, colObj)
{
var rInc = (r - stage[colObj].getTransform().rb) / speed;
var gInc = (g - stage[colObj].getTransform().gb) / speed;
var bInc = (b - stage[colObj].getTransform().bb) / speed;
if(rInc < 0)
{
rInc = - Math.ceil(Math.abs(rInc));
}
if(gInc < 0)
{
gInc = - Math.ceil(Math.abs(gInc));
}
if(bInc < 0)
{
bInc = - Math.ceil(Math.abs(bInc));
}
rInc = Math.ceil(rInc);
gInc = Math.ceil(gInc);
bInc = Math.ceil(bInc);
var nr = stage[colObj].getTransform().rb + rInc;
var ng = stage[colObj].getTransform().gb + gInc;
var nb = stage[colObj].getTransform().bb + bInc;
if(nr == 0)
{
nr = r;
}
if(ng == 0)
{
ng = g;
}
if(nb == 0)
{
nb = b;
}
if(nr == r && ng == g && nb == b)
{
clearInterval(stage[name]);
}
stage[colObj] = new Color(targ);
colTransform = new Object();
colTransform = {ra:"0",rb:nr,ga:"0",gb:ng,ba:"0",bb:nb,aa:"100",ab:"0"};
stage[colObj].setTransform(colTransform);
};
setColourScheme = function(c)
{
var i;
var myCol;
var scheme = c;
stage.sliderBg.colourScheme = scheme;
i = 0;
while(i < stage.sliderBg.navInstances.length)
{
var instance = stage.sliderBg.navInstances[i];
myCol = new Color(stage.sliderBg[instance]);
myCol.setRGB(stage.sliderBg["linkColour" + scheme]);
i++;
}
};
videoFullscreenOpen = function()
{
lingo("Flsh_featureVideoFullscreenOpen()");
};
videoFullscreenClose = function()
{
lingo("Flsh_featureVideoFullscreenClose()");
};
clickToAudioSection = function()
{
this.unloadMovie();
lingo("Flsh_itemJump(2,\"#0\")");
};
closeFeature = function()
{
this.unloadMovie();
lingo("Flsh_splashRestart");
};
_global.lingo = function(str)
{
getURL("lingo:" + str,"");
};
createGhostSlider();
clickNav(0,1);
stop();